package org.iabako.shared.entity.business;

import java.io.Serializable;

/**
 * TODO javadoc
 * Date: 24/11/13
 * Time: 18:22
 */
public abstract class AbstractEntity implements Serializable {

    public Long getId() {
        //To be override
        return null;
    }

    protected void setId(Long id) {
        //To be override
    }

    abstract public void copyDatesAsString();

    @Override
    public boolean equals(Object obj) {
        if (obj instanceof AbstractEntity) {
            Long id = ((AbstractEntity) obj).getId();
            return id != null && id.equals(getId()) || super.equals(obj);
        }
        return super.equals(obj);
    }

    @Override
    public int hashCode() {
        return getId() != null ? getId().hashCode() : super.hashCode();
    }
}
